#include "ALELaplacian.h"

CALELaplacian::CALELaplacian()
{

}

CALELaplacian::CALELaplacian(CALStepItem* pStepItem)
{
	m_pStepItem = pStepItem;
}

CALELaplacian::~CALELaplacian()
{
}


void CALELaplacian::test()
{
	//if (m_strFileName.empty()) return;

	//Mat src, gaosrc, graysrc, ladst, dst;
	//src = imread(m_strFileName);
	//imshow("input", src);
	//GaussianBlur(src, gaosrc, Size(3, 3), 0);
	//imshow("gaosrc", gaosrc);
	//cvtColor(gaosrc, graysrc, CV_RGB2GRAY);
	//imshow("graysrc", graysrc);
	//Laplacian(graysrc, ladst, -1);
	//imshow("ladst", ladst);
	//convertScaleAbs(ladst, dst);
	//imshow("dst", dst);
}


void CALELaplacian::convert()
{
	if (m_pStepItem == NULL) return;

	try
	{
		CALSIELaplacian* pStepItem = (CALSIELaplacian*)m_pStepItem;

		Mat gaosrc, graysrc, ladst, dst;

		GaussianBlur(m_srcMat, gaosrc, Size(3, 3), 0);
		cvtColor(gaosrc, graysrc, CV_RGB2GRAY);
		Laplacian(graysrc, ladst, -1);
		convertScaleAbs(ladst, m_dstMat);

		SetDstType(AL_DST_Mat_One);
	}
	catch (...)
	{

	}
}

void CALELaplacian::convert(const Mat &src, Mat &dst)
{
	//Mat gaosrc, graysrc, ladst;	
	//GaussianBlur(src, gaosrc, Size(3, 3), 0);
	//cvtColor(gaosrc, graysrc, CV_RGB2GRAY);
	//Laplacian(graysrc, ladst, -1);
	//convertScaleAbs(ladst, dst);
}